package cn.maihe.elg.operation.repository.entity;

import cn.maihe.framework.starter.base.sql.BaseEntity;
import cn.maihe.framework.starter.base.sql.MapperInterface;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.annotations.TableName;
import com.baomidou.mybatisplus.enums.FieldFill;
import com.baomidou.mybatisplus.enums.IdType;
import java.util.Date;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

@TableName("t_guarantee_progress_info")
@NoArgsConstructor
@AllArgsConstructor
@Data
@Builder
@MapperInterface("cn.maihe.elg.operation.repository.mapper.GuaranteeProgressInfoMapper")
public class GuaranteeProgressInfoDO extends BaseEntity {
    /**
     * 主键
     */
    @TableId(type = IdType.ID_WORKER)
    private Long id;

    /**
     * 交易中心订单号
     */
    @TableField(value = "center_order_id")
    private String centerOrderId;

    /**
     * 受理投保订单号
     */
    @TableField(value = "accept_order_no")
    private String acceptOrderNo;

    /**
     * 操作前原订单状态
     */
    @TableField(value = "status")
    private Integer status;

    /**
     * 审核状态0不通过 1通过
     */
    @TableField(value = "audit_status")
    private Integer auditStatus;

    /**
     * 审核意见说明
     */
    @TableField(value = "audit_remark")
    private String auditRemark;

    /**
     * 报价金额
     */
    @TableField(value = "offer_amt")
    private Long offerAmt;

    /**
     * 进度步骤：按交易中心订单号纬度递增
     */
    @TableField(value = "step")
    private Integer step;

    /**
     * 进度内容描述
     */
    @TableField(value = "content")
    private String content;

    /**
     * 操作用户中文名称
     */
    @TableField(value = "operate_user_name")
    private String operateUserName;

    /**
     * 创建时间
     */
    @TableField(value = "gmt_create", fill = FieldFill.INSERT)
    private Date gmtCreate;

    /**
     * 更新时间
     */
    @TableField(value = "gmt_modified", fill = FieldFill.INSERT_UPDATE)
    private Date gmtModified;

    /**
     * 创建用户
     */
    @TableField(value = "user_create", fill = FieldFill.INSERT)
    private String userCreate;

    /**
     * 更新用户
     */
    @TableField(value = "user_modified", fill = FieldFill.INSERT_UPDATE)
    private String userModified;

    /**
     * 订单类型 0 受理订单 1 申请订单 2 售后订单
     */
    @TableField(value = "order_type")
    private Integer orderType;

    /**
     * 操作标题
     */
    @TableField(value = "title")
    private String title;

    public GuaranteeProgressInfoVo buildVo() {
        return new GuaranteeProgressInfoVo(id, centerOrderId, acceptOrderNo, status, auditStatus, auditRemark, offerAmt, step, content, operateUserName, gmtCreate, gmtModified, userCreate, userModified, orderType, title);
    }

    public static GuaranteeProgressInfoDO of(GuaranteeProgressInfoVo vo) {
        return new GuaranteeProgressInfoDO(vo.getId(), vo.getCenterOrderId(), vo.getAcceptOrderNo(), vo.getStatus(), vo.getAuditStatus(), vo.getAuditRemark(), vo.getOfferAmt(), vo.getStep(), vo.getContent(), vo.getOperateUserName(), vo.getGmtCreate(), vo.getGmtModified(), vo.getUserCreate(), vo.getUserModified(), vo.getOrderType(), vo.getTitle());
    }
}
